<template>
    <Page class="basic company">
        <template #header>
            <el-input v-model="queryForm.userPhone" placeholder="请输入手机号"/>
            <EdDateTimeRange ref="edDateTimeRangeRef" v-model="time"></EdDateTimeRange>
            <el-button class="ed-button ed_black-bottom" @click="search()"><svg-icon class="svg-middle" icon-class="search-svg"/>查 询</el-button>
            <el-button class="ed-button ed_white_bottom" @click="reset()"><svg-icon icon-class="reset-svg"/>重 置</el-button>
        </template>
        <PageCard title="积分录入列表">
            <template #actions>
                <!-- <el-button class="ed-button ed_black-bottom ed-button36" v-has="'integral:record:add'" @click="add()"><svg-icon icon-class="add-svg"/>积分录入</el-button> -->
            </template>
            <ApiTable :api="load" ref="table" :params="queryForm">
                <el-table-column type="index" width="80" label="序号"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" prop="userName" label="姓名"/>
                <el-table-column :show-overflow-tooltip="true" prop="userPhone" label="手机号"/>
                <el-table-column :show-overflow-tooltip="true" prop="quantity" label="积分数"/>
                <el-table-column :show-overflow-tooltip="true" prop="type" label="类型">
                    <!-- <template slot-scope="scope">
                        <span v-if="scope.row.type==0">积分添加</span>
                        <span v-else-if="scope.row.type==1">积分消耗</span>
                    </template> -->
                </el-table-column>
                <!-- <el-table-column :show-overflow-tooltip="true" prop="effectiveEnd" label="积分有效期"/> -->
                <el-table-column :show-overflow-tooltip="true" prop="source" label="店铺/来源"/>
                <el-table-column :show-overflow-tooltip="true" prop="detail" label="发放/消耗明细"/>
                <el-table-column :show-overflow-tooltip="true" prop="makeTime" label="发放/消耗时间"/>
                <!-- <el-table-column :show-overflow-tooltip="true" prop="creatorName" label="操作人"/>
                <el-table-column :show-overflow-tooltip="true" prop="inputType" label="录入方式"/> -->
            </ApiTable>
        </PageCard>
    </Page>
</template>

<script>
    import Page from '../../components/Page.vue'
    import PageCard from 'src/views/components/PageCard.vue'
    import ApiTable from 'src/components/ApiTable.vue'
    import EdDateTimeRange from 'src/components/EdDateTimeRange.vue'
    import EdTable from "src/components/EdTable.vue";
    import EdExport from "src/components/EdExport.vue";
    // import {listQuery} from "src/api/activity";
    import {listQuery} from "./api";
    export default {
        name: "IntegralRecord",
        components:{EdTable,EdExport,Page, PageCard, ApiTable,EdDateTimeRange},
        data(){
            return{
                queryForm:{
                    userName:'',
                    userPhone:"",
                    quantity:'',
                    type:'',
                    source:'',
                    detail:'',
                    makeTime:'',
                    startTime:"",
                    endTime:""
                },
                time:"",
                dataApi:{
                    url:"/point/detail/export",
                    pages:0,
                    villageName:""
                },
                isEdExport:false,
            }
        },
        activated(){
            this.$nextTick  (()=>{
                this.$refs.table.load(1)
            })
        },
        methods:{
            load:listQuery,
            // add(){
            //     this.$router.push({
            //         path: '/integral/record-create'
            //     })
            // },
            // beforeAvatarUpload(file){
            //     const fileType = file.name.split('.');
            //     const fileDate = fileType.slice(-1);
            //     if (['xlsx'].indexOf(fileDate[0]) < 0) {
            //         this.$message.error('仅支持文件格式：.xlsx');
            //         return false
            //     }
            //     const isLt2M = file.size / 1024 / 1024 < 30;
            //     if (!isLt2M) {
            //         this.$message.error('上传文件大小不能超过 30MB!');
            //     }
            //     if(isLt2M){
            //         this.upFile = new FormData();
            //         this.upFile.append("file",file)
            //     }
            //     return isLt2M;
            // },
            // exportBtn(){
            //     this.dataApi.pages = this.$refs.table.getTabledData();
            //     this.dataApi.villageName = this.$store.getters.orgName;
            //     if(this.dataApi.pages > 0){
            //         this.dataApi = Object.assign(this.dataApi,this.queryForm);
            //         this.isEdExport = true;
            //     }else {
            //         this.$message.info({
            //             message:"暂无数据导出",
            //             duration: 2000,
            //             center:true
            //         })
            //     }
            // },
            // exportSuccess(){
            //     this.isEdExport = false;
            // },
            search(){
                this.queryForm.startTime = this.time[0];
                this.queryForm.endTime = this.time[1];
                this.$refs.table.load(1)
            },
            reset(){
                this.queryForm = {
                    userPhone:"",
                    startTime:"",
                    endTime:""
                };
                this.time = "";
                this.$nextTick(()=>{
                    this.$refs.table.load(1,10)
                })
            }
        }
    }
</script>

<style scoped>

</style>